﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsTheme.Helper
{
    public partial class ColorPrompt : Form
    {
        /// <summary>
        /// 拖动进度条是否被拉动过，如果拉动过才会保存
        /// </summary>
        bool trackBar1Flag = false;



        public ColorPrompt()
        {
           
            InitializeComponent();
            trackBar1.Maximum = 255;
            ChangeColor(100);
        
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SavaColor();
         
            Close();
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            trackBar1Flag = true;
        
            ChangeColor(trackBar1.Value);
            
            SavaColor();
        }

        private void SavaColor()
        {
           
            if(trackBar1Flag)
            StaticValue.Transparency = trackBar1.Value;
        
        }

        private void ChangeColor(int value)
        {
            label1.BackColor = Color.FromArgb(value,StaticValue.ColorR, StaticValue.ColorG, StaticValue.ColorB);
            label1.Text = String.Format("不透明度:{0}\r\nR:{1}\r\nG:{2}\r\nB:{3}", value, StaticValue.ColorR, StaticValue.ColorG, StaticValue.ColorB);
          
        }
    }
}
